/**
 * button have three permission 
 * deny --- all the component don't shown in layout 
 * view --- show the component in layout ,but not to be  enable
 * enable --- show and enable the component
 */
Ext.define('vsg.security.ButtonPermission', {
    extend: 'Ext.util.Observable',
    alternateClassName: 'security.ButtonPermission',

    constructor:function(config) {
		var me = this;
		
        me.callParent(arguments);
        
	},
	
	
	/**
	 * parameter type is Ext.Component and get the user permission handle ---
	 */
	isPermitted:function( button , userPerm) {
		var id = button.getId();
		
		
		if (userPerm == "deny") {
			button.hide( id );
			return false;
		}
		else if (userPerm == "view") {
			button.disabled = true;
		}
		return true;
		

		
	}

});